import { ApiProperty } from '@nestjs/swagger'
import { IsNumber, IsOptional, IsString, IsUrl } from 'class-validator'

export class CreateOcrTaskDto {
  @ApiProperty({ description: '图片或PDF的URL' })
  @IsUrl()
  url: string

  @ApiProperty({ description: '任务类型, 1 腾讯云 2 阿里云', default: 1 })
  @IsNumber()
  @IsOptional()
  taskType: number = 1

  @ApiProperty({ description: '页码，PDF时有效', required: false, default: 0 })
  @IsNumber()
  @IsOptional()
  page?: number = 0

  @ApiProperty({
    description: '识别语言类型，默认zh。可选值：zh, auto, zh_rare, jap, kor, spa等',
    required: false,
    default: 'zh',
  })
  @IsString()
  @IsOptional()
  languageType?: string = 'zh'

  @ApiProperty({ description: '是否开启PDF识别', required: false, default: false })
  @IsOptional()
  isPdf?: boolean = false
}
